function delTmb(str){
    var s=$("#us"+str);
    s.html("");
    s.hide();
    var s=$("#hide"+str);
    var usage=$("#hide"+str+">input").val().split("-")[1];
    s.html('<input type="hidden" name="temp_img" value="0-' + usage + '">');}
function pic_show(id){var t=$("#"+id);if(t.html()){t.children(".cr-delete-img").show();}}
function pic_hide(id){var t=$("#"+id);if(t.html()){t.children(".cr-delete-img").hide();}}
function add_new_line(str,hash_id){
    var s;
    switch(str){
        case"ing":
        s=$(".cr-add-ing");
        s.before('<div class="cr-ing-rows"><span class="cr-ing"><input type="text" maxlength="20" class="cr-ing-input g-border-hover" name="ing" /></span> <span class="cr-unit"><input type="text" maxlength="20" class="cr-unit-input g-border-hover" name="unit" /></span></div>');
        s.attr("href","javascript:add_new_line('ing');void(0);");
        break;
        case"steps":
        s=$(".cr-add-steps");
        s.before('<div class="cr-steps"><div class="cr-upload-text"><textarea name="step"></textarea></div><div class="cr-steps-uploader" id="upload'+hash_id+'"><iframe src="/pic_frame?ptype=steps&hash_id='+hash_id+'" frameborder="0" class="cr-steps-iframe" scrolling="no"></iframe><div class="cr-steps-success" onmouseover="pic_show(this.id);" onmouseout="pic_hide(this.id);" id="us'+hash_id+'"></div><span class="cr-steps-loadding" id="loadding'+hash_id+'">上传中 ...</span><div id="hide'+hash_id+'"><input type="hidden" name="temp_img" value="0-steps"></div></div><br class="c"/></div>');
        s.attr("href","javascript:add_new_line('steps','"+random_str()+"');");
    }
}
function random_str(n){var chars=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];var i;var c="";for(i=0;i<n;i++){var random=parseInt(25*Math.random(),10);c+=chars[random];}
return c;}